package com.southpark.demo.control.responders
{
	import com.southpark.demo.interfaces.model.IModel;
	import com.southpark.framework.control.commands.CommandFault;
	import com.southpark.framework.control.responders.AbstractResponder;
	import com.southpark.framework.control.responders.IResponder;
	import com.southpark.system.interfaces.application.IApplication;
	import com.southpark.system.interfaces.managers.IApplicationManager;
	
	import mx.core.FlexGlobals;
	
	
	public class BaseResponder extends AbstractResponder
	{
		protected var applicationManager:IApplicationManager = IApplication(FlexGlobals.topLevelApplication).applicationManager;
		protected var model:IModel = applicationManager.model as IModel;
		
		
		public function BaseResponder(responder:IResponder=null)
		{
			super(responder);
		}
		
		
		override protected function onError(commandFault:CommandFault):void
		{	
			super.onError(commandFault);
			
			var text:String = commandFault.proxyClassName
				+"<br/>back-end method: "+commandFault.backendMethod
				+"<br/>fault code: "+commandFault.fault.faultCode
				+"<br/><br/>fault detail:<br/>"+commandFault.fault.faultDetail
				+"<br/><br/>fault string:<br/>"+commandFault.fault.faultString;
				
			applicationManager.infoManager.showServerError(text);
			
		}
		
		
	}
}